﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppSocketModel;
using AppSocketService.Fence;
using AppSocketService.LinuxKafkaServerCheck;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BCGPSRESTful.Controllers.Test
{
    /// <summary>
    /// 测试用
    /// </summary>
    [ApiExplorerSettings(GroupName = "Test")]
    [Route("api/[controller]")]
    [ApiController]
    public class TestController : ControllerBase
    {
        private readonly IFencePersonService fencePersonService;


        /// <summary>
        /// 
        /// </summary> 
        public TestController()
        {
            this.fencePersonService = new FencePersonService();
        }

        #region 获取两点间距离
        /// <summary>
        /// 获取两点间距离
        /// </summary>
        /// <param name="lat1"></param>
        /// <param name="lng1"></param>
        /// <param name="lat2"></param>
        /// <param name="lng2"></param>
        /// <returns></returns>
        [HttpGet("[action]")]
        [AllowAnonymous]
        [ProducesDefaultResponseType(typeof(double))]
        public ActionResult<double> Test_GetDistance(double lat1, double lng1, double lat2, double lng2)
        {
            return fencePersonService.Test_GetDistance(lat1, lng1, lat2, lng2);
        }
        #endregion


        #region 进入围栏内 
        /// <summary>
        /// 进入围栏内
        /// </summary>
        /// <param name="companyid"></param>
        /// <param name="accountid"></param>
        /// <param name="IMEI"></param>
        /// <param name="lng"></param>
        /// <param name="lat"></param>
        /// <returns></returns>
        [HttpGet("[action]")]
        [ProducesDefaultResponseType(typeof(FenceDto))]
        [AllowAnonymous]
        public ActionResult<FenceDto> Test_IntoFence(int companyid, string accountid, string IMEI, double lng, double lat)
        {
            return fencePersonService.IntoFenceAlarm(companyid, accountid, IMEI, lng, lat);
        }
        #endregion
        
    }
}